TrekDrive by ShadowWorks v. 1.0.5
Author:  TheShadow1138
Tester(s):  Puggonaut (author of TexturesUnlimited config)

License:
--------

TrekDrive code and configs are licensed under the GPL v3 License.  All models (.mu) and textures (.dds) are licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

All bundled dependency mods are distributed under their own licenses.

Dependencies:
-------------
* B9PartSwitch by blowfish (https://forum.kerbalspaceprogram.com/index.php?/topic/140541-1112-b9partswitch-v2180-march-17/&tab=comments#comment-2601701)

* CommunityResourcePack by RoverDude (https://forum.kerbalspaceprogram.com/index.php?/topic/83007-1x-community-resource-pack/&tab=comments#comment-1364082)

* Waterfall by Nertea (https://forum.kerbalspaceprogram.com/index.php?/topic/196309-112x-waterfall-a-framework-for-continuous-mesh-driven-engine-effects-july-23/)

* ModuleManager v4.1.4 by serbian (https://forum.kerbalspaceprogram.com/index.php?/topic/50533-18x-112x-module-manager-421-august-1st-2021-locked-inside-edition/&tab=comments#comment-720814)

What's Included:
----------------
* TrekDrive.dll
* WarpCore test article (Part) - a modified cfg of the Rockomax16 tank
* WarpCoil test article (Part) - a modified cfg of the Size1Tank_02
* Phoenix warp ship and launcher.
* Phoenix Warp Ship Test (craft file)
* Enterprise-era Shuttlepod
* NX-class Starship parts
* NX-class Refit parts
* 6 NX-class variant craft files
* Constitution-class Starship parts
* 1 Constitution-class craft file
* Type F Shuttlecraft
* Type F Shuttlecraft craft file
* Mirror Universe Texture Variants (NX, Shuttlepod, Constitution, and Type F Shuttlecraft) and Flag
* Falcon Warpship (craft file) - uses the above parts and other stock parts
* Constitution-class Refit parts
* Constitution-class Refit craft file
* Source code for TrekDrive.dll

INSTALLATION:
-------------
In the unpacked archive you will find three (3) folders:  "Craft", "GameData", and "Source".  To install the mod simply copy the contents of the "GameData" folder into your KSP installation's GameData folder.  Do not "merge", but "replace" any perviously installed TrekDrive folders.  As long as you have the most up-to-date versions of the bundled dependencies you don't need to worry about copying them.  If you do not already have the bundled dependencies installed, you must copy those folders into your KSP GameData folder as well.

To Install Craft Files:  If you want to use the included craft files, simply copy the ".craft" files into your desired craft file location.  Installed in the "Ships" -> "VAB/SPH" folder in your main KSP directory will make the craft available to all saves.  If you wish to install the craft in a particular save, copy the ".craft" files in "saves" -> name of the save -> "Ships" -> "VAB/SPH".


Change Log:
-----------
v.1.0.5 - Now With Inventory
----------------------------
* Updated TrekDrive.dll
	* Fixes a crash when taking a Kerbal on EVA on a landed craft with active impulse engines.  You can now EVA your Kerbals from landed NX Shuttlepods or Type F shuttlecraft without having to shutdown the impulse engines first.

* Added Inventory space to the NX Shuttlepod fuselage, the Type F main hull, NX-class saucer, Constitution and Constitution Refit saucers and engineering sections.


v.1.0.4 - The Refit Commeth
---------------------------
* Updated TrekDrive.dll
	* Adds speed multipliers for Physical Time-Warp.  2x Physical Time-Warp give s 100x multiplier to speed, 3x Physical Time-Warp gives a 1000x speed multiplier, and 4x Physical Time-Warp gives a 10,000x speed multiplier.  This is a work-around for not being able to use the warp drive in Non-Physical Time Warp, giving effectively up to a 10,000x Time-Warp using Physical Time-Warp.  No more forced real-time warp travel for interstellar distances!

* Added Constitution-class Refit
	* Saucer
	* Bridge Module
	* Impulse Engine
	* Engineering Section
	* Warp Nacelle Pylons
	* Warp Nacelles (Port and Starboard)
* Texture switches for the Constitution Refit for an overall gray and Kerbban Empire
* Multiple registry switches
	* USS Enterprise (NCC-1701) - Default
	* USS Enterprise (NCC-1701-A)
	* USS Ahwahnee (NCC-2048)
	* USS Bonhomme Richard (NCC-1731)
	* USS Cassie (NCC-1711)
	* USS Cayuga (NCC-1721)
	* USS Constellation (NCC-1789)
	* USS Constitution (NCC-1021)
	* USS Defiant (NCC-1804)
	* USS Eagle (NCC-956)
	* USS Emden (NCC-1856)
	* USS Endeavour (NCC-1895)
	* USS Essex (NCC-1697)
	* USS Excalibur (NCC-1664)
	* USS Exeter (NCC-1672)
	* USS Hood (NCC-1703)
	* USS Hornet (NCC-1708)
	* USS Intrepid (NCC-1631)
	* USS Kearsarge (NCC-1733)
	* USS Kongo (NCC-1710)
	* USS Korolev (NCC-2014)
	* USS Kurosawa (NCC-1963)
	* USS Lexington (NCC-1709)
	* USS Merrimac (NCC-1715)
	* USS Olympia (NCC-1771)
	* USS Porthos (NCC-1712)
	* USS Potemkin (NCC-1657)
	* USS Ticonderoga (NCC-1714)
	* USS Yamato (NCC-1716)
	* USS Yorktown (NCC-1717)
* Registry fix for the Constitution-class (non-Refit) for USS Essex to change the registry number from NCC-1709, that for the USS Lexington, to NCC-1697 to avoid having two NCC-1709s and to use the registry that has been attributed to the Constitution-class USS Essex.

* Added TMP Era Inspection pod (as seen in Star Trek: The Motion Picture, and other TOS films)  Can be docked to any external docking ports on the Constitution-class Refit, Constitution-class, or NX-class vessels, as well as any other 1.25m/size1 docking port.
* Inspection pod does allow use of the JSI Advanced Transparent Pod mod to have a visible interior in external camera views.  This is not a new dependency, it's there for those who want the functionality.

* Added TMP drydock (from the Enterprise reveal/fly-around scene).
	*  No engines, just RCS, so it will need to be cheated into orbit, or attach and Inspection pod, or other craft to tow it to orbit.
	*  6x dorsal docking ports.  These are size1/1.25 m ports.  Inspection pods can dock using their ventral docking port (built into the pod not a separate piece), or the aft docking port (a separate piece).
	* Forward and Aft hangars with pads for Inspection pods in a sectioned off area, and pads for shuttlecraft (Type-F, and future types).  This allows for crews to disembark from docked starships and use shuttlecraft to go to the surface, or new crew to be flown to the drydock to embark on a starship.
	* Airlocks are located in each main hangar to allow Kerbal EVA from the drydock.
	* Two extendable docking arms to allow docking from either end.  The arm must be extended before docking.  To undock, bring up the saucer's PAW and select "Undock".
		*  Due to the way it's set up, after switching vessels, or loading, extended and/or docked arms will appear partially retracted.  This is visual only, and can be resolved by retracting and then extending the arm.
	* Possesses generators to generate starship resources (LqdDeuterium and Antimatter).  This can be used to resupply docked starships.
	* Possesses a "fusion reactor" (a generator module that consumes LqdDeuterium to generate ElectricCharge).

	* Implements ExtraPlanetary Launchpad orbital construction to allow for construction of starships in orbit.
		*  Once the ship is built and released you will need to dock the station to the ship.  When the ship is released it becomes the focused craft.  Simply switch focus to the drydock (extend the docking arm if it isn't already) then use the "J" or "L" keys to gently translate the drydock docking arm towards the ship.  The drydock docking arms are set to have 200% acquireForce by default, which makes it much easier.  Once the drydock and ship are docked you can easily transfer crew from the station to the ship.  You can then undock the ship and fly it out of spacedock.  Just remember, "thrusters only while in spacedock Captain."


v1.0.3b - Log Spam Hotfix
-------------------------
* Updated TrekDrive.dll to remove spamming the debug log with the number of warp
coils that are charged.

v1.0.3a - Warp Drive Hotfix
---------------------------
* Updated TrekDrive.dll
	* Updated the CheckStatus function to check if the minimum number of nacelles
	  have been charged instead of all nacelles on the ship. Fixes an issue where
	  embarked warp-capable shuttles prevents the mothership from going to warp.
	* Updated the warp coil code so that coils that are not charged will not try to
	  drain themselves and prevent the ship from going to warp if the minimum number
	  of nacelles are in fact charged.

v1.0.3 - The Galileo Seven
---------------------------
* Added Type F Shuttlecraft (all parts have two texture variants)
	* Main Hull (crew capacity of 7)
	* Impulse Engine
	* Warp Core
	* Type F Warp Nacelles (Port & Starboard)
* Added warpEffectParent.mu (an empty transform model)
	This model is in "TrekDrive/Generic" along with usage instructions
* Added a WaterfallFX template for the TrekDrive warp stars effect to make it easier for others to add the effect to non-TrekDrive parts.
* Added Mirror Universe texture variants and registry/name variants for the Type F Shuttlecraft.
* Updated all parts with the SW_ModuleWarpGenertor module to have a warpEffectParent transform to standardize the transform to which the warp stars effect is parented. (Doesn't affect anything, all effects are intact and the same as before.)
* Updated all parts with RCS thrusters to use LqdDeuterium, removing MonoPropellant entirely from the parts.  To maintain propellant consumption rates all RCS thrusters' ISP were increased by a factor of 25.
* Updated surface attach node on NX-class warp nacelles allowing for sane surface attachment.
* Updated TrekDrive.dll to apply forward and reverse impulse thrust per-part instead of to the vessel as a whole (thrust vectoring still works).

v1.0.2 - The Original Reborn
-----------------------------
* Added Constitution-class Starship (all parts have two texture variants)
	* Bridge Module (crew capacity of 6)
	* Saucer (crew capacity of 30)
	* Impulse Engines (includes a docking port)
	* Engineering Hull (crew capacity of 20)
	* Navigational Deflector
	* Nacelle Pylons (two variants: flared and straight)
	* Warp Nacelles (Port and Starboard)
* Starship Registry Variants (present on Saucer, Engineering Hull, and Nacelles [port & starboard]
	* USS Bonhomme Richard (NCC-1731)
	* USS Cassie (NCC-1711)
	* USS Constellation (NCC-1017)
	* USS Constitution (NCC-1021)
	* USS Defiant (NCC-1764)
	* USS Eagle (NCC-956)
	* USS Emden (NCC-1856)
	* USS Endeavour (NCC-1895)
	* USS Enterprise (NCC-1701) - The Default
	* USS Essex (NCC-1709)
	* USS Excalibur (NCC-1664)
	* USS Exeter (NCC-1672)
	* USS Hood (NCC-1703)
	* USS Hornet (NCC-1708)
	* USS Intrepid (NCC-1631)
	* USS Kearsarge (NCC-1733)
	* USS Lexington (NCC-1709)
	* USS Porthos (NCC-1712)
	* USS Potemkin (NCC-1657)
	* USS Ticonderoga (NCC-1714)
	* USS Yamato (NCC-1716)
	* USS Yorktown (NCC-1717)
* Added two (2) new registries for the NX-class and NX-class
	* Cassie (NX-11)
		* S.S. Cassie (NX-11)
	* Porthos (NX-12)
		* S.S. Porthos (NX-12)
* Added Mirror Universe Kerbban Empire Content in "Extras" (content is encapsulated and may be easily removed by deleting either the "Extras" folder, or the "MirrorUniverse" folder inside "Extras")
	* Kerbban Empire Texture Variants to the following parts
		* NX-class Saucer
		* NX-class Engineering Section Refit
		* NX-class Warp Nacelle Refit (Warp 7 Nacelles) Port and Starboard
		* Enterprise-era Shuttlepod fuselage
		* Constitution-class Saucer
		* Constitution-class Engineering Section
		* Constitution-class Warp Nacelles Port and Starboard
	* Kerbban Empire Registry variants for all currently available registry variants on the NX-class and Constitution-class ships
	* Flag of the Kerbban Empire
* Added Textures Unlimited patch - authored by Puggonaut with "excludeMesh" statements provided by TheShadow1138 so that registries appear correctly with this config.


v1.0.1 - Thrust Vectoring
--------------------------
* Updated plugin to add thrust vectoring to impulse engines.
  Thrust vectoring is toggleable in the PAW and by Action Group
* Added a new parameter to impulse engine CFGs, "maxVectorAngle" a value in degrees
  to control the amount of vectoring.  Default value is 15º.


v1.0 - Initial Full Release
------------------------------------------
* Includes:
	* Phoenix Warpship
	* Phoenix Warpship launcher
	* Enterprise-era Shuttlepod
	* NX-class starship
* Added A User's Manual
* Added NX-class Bridge IVA and Props
* Updated warp stars configs so that they are visible in the Bridge IVA
* Updated the plugin to add an ambient rumble sound for the warp core.  The sound is customizable by simply editing the CFGs with SW_ModuleWarpCore to give the path to your desired sound.
* Added ENT-era Shuttlepod IVA (Stock and MAS versions)
* Updated Shuttlepod Impulse engines to have a hover altitude of 1000m
* Added ModuleLiftingBody to the Shuttlepod fuselage improving flight characteristics
* Balanced the RCS and COM of the Shuttlepod removing most if not all unwanted movement during docking or other maneuvers.
* Updated SW_ModuleImpulseEngine to apply Takeoff/Landing forces to every part to provide even acceleration to the entire vessel almost entirely removing the need for RCS or SAS to keep the vessel level during takeoff/landing in atmosphere.


v0.99.1w - Spacedock
--------------------
* Added a ModuleManager patch for StinkyAce's Spacedock, available at this link:
https://spacedock.info/mod/1815/USS%20Nimitz%20and%20Drydock
The patch scales the dock down to 0.6, a near perfect fit for the NX-class, and instead of modifying the drydock that comes with StinkyAce's mod, it creates a new part with the aforementioned scale, an impulse engine (no part, just the module), and produces the resources used by TrekDrive ships.  This will be a good refueling station for the NX.

* Updated the plugin
	* Fixed an NRE spam in the impulse engine code while in the editor
	* Added the ability to select a "forward" or "reverse" mode for the impulse engines.  Toggleable in the PAW, and can be set as an action group.

* Cleaned up the Waterfall patch by splitting the warp effects into their own patch.
* Tweaked the texture tiling on the NX warp effects (both the Warp 5 and Warp 7 versions).

v0.99w - NX-class Release
-------------------------
* B9PartSwitch is now a hard dependency. (Included in download)
* Updated the TrekDrive.dll
	* Warp speed formula changed to allow faster interstellar travel
	* OnLoad function updated to not automatically set the warp drive to "Not Ready"
	  if it was in a "Ready" state at the last save.  This allows the player to
	  immediately engage the drive after the vessel loads, if the drive is in a Ready
	  state upon loading.
* Added NX-class Starship Parts
	* Bridge module (Crew capacity of 6)
	* Saucer section (Crew capacity of 20)
	* Engineering section
	* Nacelle Pylons (B9PartSwitch variants)
		* Upper variant (2 upper pylons)
		* Lower variant (2 lower pylons)
		* Four variant (2 upper & 2 lower pylons)
	* Warp Nacelles (Port & Stbd)
	* Main Impulse Engines (Port & Stbd)
	* Secondary Impulse Engines (Port & Stbd)
	* Navigational Deflector (2 variants) - Serves as a transmitter
		* NX-01 Oval "Mark I" Deflector
		* NX-02 Rectangular "Mark II" Deflector
* Added NX-class Refit Starship Parts
	* Engineering Section Refit (Includes warp 7 warp core and warp drive, Crew capacity of 10)
	* Refit Warp Nacelles (Port & Stbd)
* Added Custom Waterfall FX model and texture for streaking stars at warp effect.
* Updated the warp stars effect on the Phoenix
* Added six (6) craft files for the NX-class and NX-class Refit
	* NXClass_A:  Standard NX-class starship (as seen in Star Trek: Enterprise)
	* NXClass_B:  NX-class starship with two (2) ventrally (lower) mounted nacelles
	* NXClass_C:  NX-class with four (4) nacelles
	* NXClass_Refit_A:  Standard NX-class starship Refit
	* NXClass_Refit_B:  NX-class Refit with two (2) ventrally (lower) mounted nacelles
	* NXClass_Refit_C:  NX-class Refit with four (4) nacelles

v0.9w - Shuttlepod & Impulse Engine Release
-------------------------------------------
* Updated the TrekDrive.dll
	* All TrekDrive buttons/toggles can now be set as Action Groups
	* SW_ModuleImpulseEngine Added - automatic takeoff and landing modes when sub-orbital, it will not automatically land from orbit.
	* SW_ModuleBussardCollector Added - When the collector is activated it will collect at a random rate for a random period of time before choosing another random rate and period of time.  Collects LqdDeuterium and Antimatter with LqdDeuterium collecting at a higher rate.  Collection will only occur at sub-light velocities.
* Updated Waterfall version.
* Updated Waterfall effect on the Phoenix Launcher Main Engine to correct a position issue.
* Added a Waterfall effect to the Phoenix - visible when traveling at warp; the effect is based on the streaking stars warp effect from TNG - VOY and ENT.
* Added Enterprise-era Shuttlepod
	* Shuttlepod main body - holds 5 kerbals with airlocks on both sides (No IVA)
	* Shuttlepod Impulse Engine

v0.7.5w - OnLoad Hotfix:
------------------------
* Corrected an issue that prevented engaging the warp drive after switching to another vessel, after reloading the game, or any other loading action.  Upon switching back to the warp ship, or loading the save, the warp drive will be automatically disengaged and set to "Not Ready" status.  Simply clicking "Check Ready Status" and then engaging the warp drive will get you ready to go.

v0.7w - Phoenix IVA release:
----------------------------
* Added Phoenix IVA (Stock and MOARdV's Avionics System)
* The MAS version replaces some of the central props with MAS props, and replaces the Main Display with a functional MFD
* MAS version of the IVA will only be available with MAS is installed.

v0.6w - Phoenix Initial release:
--------------------------------
* Updated Code:
	* Added nacelle glow animation capability, giving a visual indicator of coil charge.
	* Fixed coil charge logic to allow charging a partially discharged coil
	* Fixed a logic issue with the Warp Field Generator code.  Now the "not enough charge" warning will only occur if the warp drive is active.
* Moved to LqdDeuterium and Antimatter from Community Resource Pack
* Added Phoenix Parts:
	* Phoenix Crew Cabin (no IVA currently, built-in RCS, no effects yet)
	* Phoenix SAS (contains Monopropellant and Electric Charge)
	* Phoenix Fuselage (contains LqdDeuterium and Antimatter)
	* Phoenix Nacelle (deployable warp nacelle)
	* Phoenix Warp Core/Warp Field Generator
	* Phoenix Main Thruster (matter-antimatter rocket engine)
	* Phoenix Vernier Thruster (matter-antimatter rocket engine)
	* Phoenix Fairing (to conceal the warp nacelles during launch)
	* Phoenix Interstage Decoupler
	* Phoenix Launcher First Stage
	* Phoenix Launcher Main Engine (Liquid Fuel Oxidizer engine)
* Added Phoenix Warp Ship Test craft.
* Added Community Resource Pack and Waterfall as hard dependencies (bundled)

v0.5w - Initial WIP release:
----------------------------
* Added TrekDrive.dll plugin
* Added Warp Core Test Article
* Added Warp Coil Test Article
* Added Falcon Warpship craft
* Source code



How to Use the TrekDrive:
-------------------------

Steps to Activate the Drive:
----------------------------
(All actions are in the Part Action Windows [PAW])
Step 1: Activate the Warp Core by clicking the "Warp Core Status" toggle
Step 2: Charge the Warp Coil(s) by clicking "Charge Warp Coils" in the coil PAW
Step 3: Once the coils are charged click "Check Ready Status" on the Warp Generator (combined with the Warp Core Test Article here)
Step 4: Once the "Ready Status" reads "Ready", click "Engage Warp Drive" on the Warp Generator.  This will change from "Drive Inactive" to "Drive Engaged"

NOTE: Once the drive is engaged, any throttle input will move the ship at warp speeds.  To return to non-warp operations simply click the "Engage Warp Drive" toggle to disengage the drive.

Step 5: (with the drive engaged) Simply apply throttle to move at warp speeds.  50% throttle is 50% of maximum warp, 100% throttle is maximum warp

Other Usage Notes:
-------------------
Cutting the Throttle:  Throttling to 0% drops the ship from warp.  If the "Easy" orbit mode is selected (it is by default), it will place the vessel in as close to a circular orbit as possible automatically based on the current reference body and the ship's distance from the reference body.  If the "Realistic" orbit mode is selected, the orbit is automatically determined based on the ship's original velocity vector and the current position relative to the current reference body.

Running out of Electricity:  The Warp Generator, or Warp Field Generator, required electric charge to operate, and if there is not enough electric charge to operate, the drive automatically disengages, dropping the ship immediately from warp.

Discharging the Coils:  As the ship moves at warp speeds, the warp plasma in the coils is consumed.  If the supply of warp plasma ends (i.e. the warp core is shutdown or matter or anti-matter are depleted) the coils will eventually completely discharge.  If this occurs, the drive will automatically disengage, dropping the ship from warp immediately.

Warp Coil Efficiency:  Warp coils heat up as they consume warp plasma.  Heating occurs at an exponential rate, reaching maximum heating at maximum warp.  Each coil has an efficiency rating that counters the heating (the more efficient the coil the longer it can run at maximum warp).  Right now there is an enforced upper limit of 1.0 efficiency (100%) such that if the efficiency of the coil is defined to be larger than 1.0, a random float between 0.0 and 1.0 will be chosen by the plugin.

Warp Core, Warp Generator, Warp Coil:  For a ship to travel at warp it requires a warp core (to generate warp plasma and electric charge), a warp coil (that requires a constant supply of warp plasma), and a warp generator (that requires warp coils to generate the warp field [not visualized]).

	Warp Core: requires matter (deuterium) and anti-matter (anti-deuterium) to generate warp plasma and electric charge

	Warp Coil: requires warp plasma to charge the coil for operation

	Warp Field Generator: requires a predetermined minimum number of warp coils and electric charge to generate the warp field.  This is where the drive is implemented, without a Warp Field Generator, or simply Warp Generator, the ship cannot travel at warp speeds.